<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript" src="../js/vue.js"></script>
    <script type="text/javascript">Vue.config.productionTip = false</script>
    <title>天气案例</title>
</head>
<body>
    <div id="weather">
         <h2>今天的天气是，{{info}},{{x}}</h2><br/>
         <button @click="chengeWeather">点我改变天气</button>
         <!-- 绑定事件的时候：@xxx="yyy" yyy可以写一些简单的语句 -->
         <!-- <button @click="window.alert(1)">点我改变天气</button> -->
    </div>

    <script type="text/javascript">
        new Vue({
            el:"#weather",
            data:{
                isHost:true,
                x:1,
                // window
            },
            computed: { //计算属性
                info(){
                    return this.isHost ? '炎热':'凉爽'
                }
            },
            methods: { //函数方法
                chengeWeather(){
                    this.isHost = !this.isHost
                    this.x++
                }
            },
            watch:{
                
            }
        })
    </script>
</body>
</html>